package com.kingsoft.dc.khaos.extender.meta.impl;

import com.alibaba.fastjson.JSON;
import com.kingsoft.dc.khaos.extender.meta.model.ds.Connect;
import com.kingsoft.dc.khaos.extender.meta.model.ds.GreenPlumConnect;
import com.kingsoft.dc.khaos.extender.meta.utils.RSAEncrypt;

/**
 * create by yansu on 2019/12/31 11:48
 */
public class GreenPlumDmMetaImpl extends DmMetaImpl {
    @Override
    public Connect decryptDatasourceConnectSecret(String config) {
        GreenPlumConnect connect = JSON.parseObject(config, GreenPlumConnect.class);
        try {
            connect.setPassword(RSAEncrypt.decryptByRSAPassWord(connect.getPassword()));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return connect;
    }
}
